// ignore_for_file: prefer_typing_uninitialized_variables, must_be_immutable

import 'package:flutter/cupertino.dart';

class ShowListActionWidget extends StatefulWidget {
  ShowListActionWidget(
      {Key? key, this.title, this.confirmCallback, required this.options})
      : super(key: key);
  final confirmCallback;
  final title;
  List<String> options;
  @override
  State<ShowListActionWidget> createState() => _ShowListActionWidgetState();
}

class _ShowListActionWidgetState extends State<ShowListActionWidget> {
  String inputValue = "";

  @override
  Widget build(BuildContext context) {
    return CupertinoActionSheet(
      title: widget.title == ''
          ? null
          : Text(
              widget.title,
              style: const TextStyle(fontSize: 22),
            ),
      actions: widget.options.map((e) {
        return CupertinoActionSheetAction(
          onPressed: () {
            Navigator.pop(context);
            widget.confirmCallback(e);
          },
          child: Text(
            e,
            style: const TextStyle(fontSize: 17, color: Color(0xFF333333)),
          ),
        );
      }).toList(),
      cancelButton: CupertinoActionSheetAction(
        onPressed: () {
          Navigator.pop(context);
        },
        child: const Text('取消'),
      ),
    );
  }
}
